#include<iostream>
#include<csignal>
#include<unistd.h>

using namespace std;

void handler(int signal)
{
    cout<<"my pid is : " <<getpid()<<endl;
}

int main()
{
    struct sigaction act;
    act.sa_handler=handler;
    sigemptyset(&act.sa_mask);
    act.sa_flags=SA_RESTART;

    sigaction(2,&act,NULL);

    while(true)
    {
        sleep(1);
        cout<<"wait..."<<endl;
    }

    return 0;
}